<script>
/* 引入echarts的支持 */
import * as echarts from 'echarts';
export default {
  data() {
    return {
      drawer: false,
      direction: 'rtl',
    };
  },
  methods: {
    handleClose(done) {
      done();
    },
  },
  mounted() {
    // 基于准备好的dom，初始化echarts实例
    const myChart = echarts.init(document.getElementById('main'));

    // 绘制饼状图的数据
    const data = [
      { value: 335, name: '直接访问' },
      { value: 310, name: '邮件营销' },
      { value: 234, name: '联盟广告' },
      { value: 135, name: '视频广告' },
      { value: 1543, name: '搜索引擎' }
    ];
    // 配置项
    const option = {
      title: {
        text: '各渠道访问来源占比',
        subtext: '纯属虚构',
        left: 'center'
      },
      tooltip: {
        trigger: 'item'
      },
      legend: {
        orient: 'vertical',
        left: 'left'
      },
      series: [
        {
          name: '访问来源',
          type: 'pie',
          radius: '50%',
          data: data,
          emphasis: {
            itemStyle: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: 'rgba(0, 0, 0, 0.5)'
            }
          }
        }
      ]
    };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
  }
}
</script>

<template>
  <div class="container">
    <div class="d1">
      <div class="d11">
        <button @click="drawer = true">
          Bili bili
        </button>
      </div>
      <div class="d12">
        备忘录
      </div>
    </div>
    <div class="d2">,
    </div>
    <!-- 抽屉 -->
    <el-drawer
        size="78%"
        title="BiliBili"
        :visible.sync="drawer"
        :direction="direction"
        :before-close="handleClose">
      <div style="width: 100%; height: 100%;overflow: hidden">
        <iframe id="myIframe"  src="https://www.bilibili.com/" frameborder="0"  style="width: 100%; height: 100%"></iframe>
      </div>
    </el-drawer>

  </div>
</template>

<style scoped>
.container{
  display: flex;
}
.d1{
  margin-left: 36px;
  margin-top: 24px;
  width: 380px;
  height: 620px;
  padding: 12px;
  box-sizing: border-box;
  display: flex;
  justify-content: space-around;
  flex-direction: column;
}
.d11{
  text-align: center;
  line-height: 120px;
  width: 100%;
  height: 120px;
  border-radius: 20px;
}
.d12{
  text-align: center;
  line-height: 360px;
  width: 100%;
  height: 360px;
  background: white;
  border-radius: 20px;
}
.d2 {
  text-align: center;
  line-height: 620px;
  display: inline-block;
  margin-left: 18px;
  margin-top: 24px;
  background: white;
  width: 920px;
  height: 620px;
  border-radius: 18px;
  overflow: hidden;
}
.d11 button{
  width: 100%;
  height: 100%;
  border-radius: 18px;
  border: none;
  font-size: 24px;
  font-weight: 800;
  color: white;
  background: pink;
}
</style>